package com.ssc.controller;

import com.ssc.common.AjaxResult;
import com.ssc.controller.vo.UserVO;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.validation.Valid;

/**
 * 用户注册
 *
 * @author wuxianji
 * @since 2017/10/31 14:21
 **/
@Controller
public class RegisterController {

    @RequestMapping(value = "/register",method = RequestMethod.POST)
    @ResponseBody
    public String doRegister(@Valid UserVO user, BindingResult bindingResult) {

        AjaxResult ajaxResult = AjaxResult.createSuccess();
        if (bindingResult.hasErrors()) {
            ajaxResult.setErrorData(bindingResult);
        }

        return ajaxResult.toString();
    }
}
